package com.gome.ocean.common.enums.authority;

/**
 * Created by liuqingxia on 2016/6/2.
 */
public enum UrlMethodType {

                           GET(0), POST(1);

    private int value;

    private UrlMethodType(int value){
        this.value = value;
    }

    public static UrlMethodType getUrlMethodType(int value) {
        for (UrlMethodType type : UrlMethodType.values()) {
            if (type.getValue() == value) {
                return type;
            }
        }
        return null;
    }

    public static UrlMethodType getUrlMethodType(String type) {
        if (type.equalsIgnoreCase("get")) {
            return GET;
        }
        if (type.equalsIgnoreCase("post")) {
            return POST;
        }
        return null;
    }

    public String getTypeStr() {
        if (value == 0) {
            return "get";
        }
        if (value == 1) {
            return "post";
        }
        return null;
    }

    public int getValue() {
        return value;
    }
}
